/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.FileInputStream;

/**
 * <p>Project: jse2303 - Ex7
 * <p>Powered by webrx On 2023-07-24 09:49:20
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex7 {
    public static void main(String[] args) {
        //统计文件多少行
        String file = "D:\\0703\\javase\\jse2303\\jse2303\\ch09\\src\\cn\\webrx\\Dir1.java";
        System.out.println(getRow(file));
    }

    public static long getRow(String src) {
        try (var is = new FileInputStream(src)) {
            return new String(is.readAllBytes()).lines().count();
        } catch (Exception e) {
        }
        return 0;
    }

}
